using System;

namespace IFXplus.Northwind
{
    [Serializable]
    public class Customer : ICloneable
    {
        #region Fields
        
        private string _CustomerId = default(string);
        private string _CompanyName = default(string);
        private string _ContactName = default(string);
        private string _ContactTitle = default(string);
        private string _Address = default(string);
        private string _City = default(string);
        private string _Region = default(string);
        private string _PostalCode = default(string);
        private string _Country = default(string);
        private string _Phone = default(string);
        private string _Fax = default(string);
        
        #endregion

        #region Constructor

        public Customer() {}

        public Customer(string customerid, string companyname, string contactname, string contacttitle, string address, string city, string region, string postalcode, string country, string phone, string fax)
        {
            CustomerId = customerid;
            CompanyName = companyname;
            ContactName = contactname;
            ContactTitle = contacttitle;
            Address = address;
            City = city;
            Region = region;
            PostalCode = postalcode;
            Country = country;
            Phone = phone;
            Fax = fax;
        }

        #endregion

        #region Properties

        public string CustomerId
        {
            get { return _CustomerId; }
            set { _CustomerId = value; }
        }
        
        public string CompanyName
        {
            get { return _CompanyName; }
            set { _CompanyName = value; }
        }
        
        public string ContactName
        {
            get { return _ContactName; }
            set { _ContactName = value; }
        }
        
        public string ContactTitle
        {
            get { return _ContactTitle; }
            set { _ContactTitle = value; }
        }
        
        public string Address
        {
            get { return _Address; }
            set { _Address = value; }
        }
        
        public string City
        {
            get { return _City; }
            set { _City = value; }
        }
        
        public string Region
        {
            get { return _Region; }
            set { _Region = value; }
        }
        
        public string PostalCode
        {
            get { return _PostalCode; }
            set { _PostalCode = value; }
        }
        
        public string Country
        {
            get { return _Country; }
            set { _Country = value; }
        }
        
        public string Phone
        {
            get { return _Phone; }
            set { _Phone = value; }
        }
        
        public string Fax
        {
            get { return _Fax; }
            set { _Fax = value; }
        }
        
        #endregion

        #region Methods

        public Customer Clone()
        {
            return new Customer(CustomerId, CompanyName, ContactName, ContactTitle, Address, City, Region, PostalCode, Country, Phone, Fax);
        }

        #endregion

        #region ICloneable Members

        object ICloneable.Clone()
        {
            return Clone();
        }

        #endregion

        #region Compare

        public static bool operator ==(Customer obj1, Customer obj2)
        {
            if (ReferenceEquals(obj1, obj2))
                return true;
            else if (ReferenceEquals(obj1, null) || ReferenceEquals(obj2, null))
                return false;
            return (obj1.CustomerId == obj2.CustomerId && obj1.CompanyName == obj2.CompanyName && obj1.ContactName == obj2.ContactName && obj1.ContactTitle == obj2.ContactTitle && obj1.Address == obj2.Address && obj1.City == obj2.City && obj1.Region == obj2.Region && obj1.PostalCode == obj2.PostalCode && obj1.Country == obj2.Country && obj1.Phone == obj2.Phone && obj1.Fax == obj2.Fax);
        }

        public static bool operator !=(Customer obj1, Customer obj2)
        {
            return !(obj1 == obj2);
        }

        public override bool Equals(object obj)
        {
            if (!(obj is Customer))
                return false;
            return this == (Customer)obj;
        }

        public override int GetHashCode()
        {
            return CustomerId.GetHashCode();
        }

        #endregion
    }
}